@extends('layout.home.master')
@section('content')
    <div class="container mt-4">
        <div class="row mt-2">
            <div class="col-9">
                <!-- Files -->
                <div class="card" data-toggle="lists" data-lists-values="[&quot;name&quot;]">
                    <div class="card-header">
                        <div class="row align-items-center">
                            <div class="col">

                                <!-- Title -->
                                <h4 class="card-header-title">
                                    话题
                                </h4>

                            </div>
                            <div class="col-auto">
                                <!-- Button -->
                                <a href="{{route('topic.create')}}" class="btn btn-sm btn-primary">
                                    发表话题
                                </a>
                            </div>
                        </div> <!-- / .row -->
                    </div>
                    @foreach($Topics as $topic)
                    <div class="card-body">
                        <div class="row align-items-center">
                            <div class="col-auto">

                                <!-- Avatar -->
                                <a href="profile-posts.html" class="avatar avatar-lg">
                                    <img src="{{$topic->user->icon}}" alt="..." class="avatar-img rounded-circle">
                                </a>

                            </div>
                            <div class="col ml--2">

                                <!-- Title -->
                                <h4 class="card-title mb-1">
                                    <a href="{{route('topic.show',$topic)}}"><span class="badge badge-primary mr-2">{{$topic->column->name}}</span>{{$topic->title}}</a>
                                </h4>

                                <!-- Text -->
                                <p class="card-text small text-muted mb-1 mt-2">
                                </p>

                                <!-- Status -->
                                <p class="card-text small text-muted mt-3">
                                    <span class="fe fe-user "></span> {{$topic->user->name}}<span class="fe fe-clock ml-3 "></span>
                                    {{$topic->created_at->diffForhumans()}}
                                    <span class="fe fe-heart ml-2"> {{$topic->favorite_num}}</span>
                                    <span class="fe fe-thumbs-up ml-2"> {{$topic->zan_num}}</span>
                                </p>


                            </div>
                            <div class="col-auto">

                                <div class="dropdown">
                                    <a href="#!" class="dropdown-ellipses dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" data-expanded="false">
                                        <i class="fe fe-more-vertical"></i>
                                    </a>
                                    <div class="dropdown-menu dropdown-menu-right">
                                        <a href="#!" class="dropdown-item">
                                            查看
                                        </a>
                                        <a href="{{route('topic.edit',$topic)}}" class="dropdown-item">
                                            编辑
                                        </a>
                                        <a href="#!" class="dropdown-item">
                                            删除
                                        </a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-auto">
                            </div>
                        </div>
                        <!-- / .row -->
                    </div>

                    @endforeach


                </div>
                <ul class="pagination justify-content-center" role="navigation">
                    {{--{{$articles->links()}}--}}
                </ul>
            </div>
            <div class="col-sm-3">
                <div class="card">
                    <div class="card-header">
                        公告
                    </div>
                    <div class="card-body">
                        <a href="" class="text-muted">每晚直播</a>
                        <hr>
                        <a href="" class="text-muted">实战培训</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
